<template>
  <div class="ad-item">
    <div class="item-head">
      <img class="img" :src="data.image"/>
      <div class="item-title">{{data.title}}</div>
      <div class="item-num">{{data.succeed_loans}}人成功贷款</div>
      <div v-if="false" class="tag" :class="`tag${data.charact_flag}`"></div>
    </div>
    <div class="item-content">
      <div class="content-left">
        <p class="left-title">{{data.lending_time}}</p>
        <p class="left-txt">到账时间</p>
      </div>
      <div class="content-right">
        <div class="rigth-content">
          <div class="rigth-content-item">{{data.min_credit}} - {{data.max_credit}}</div>
          <div class="rigth-content-item">
            {{data.time_span === 0 ? '月' : '日'}}利率{{data.expense_monthly}}
          </div>
          <div class="rigth-content-item">贷款期限{{data.min_audit === data.max_audit ? data.max_audit : `${data.min_audit}-${data.max_audit}`}}天</div>
        </div>
        <div class="rigth-button">
          <button class="button">申请贷款</button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data () {
    return {
      types: [
        ''
      ]
    }
  }
}
</script>
<style lang="scss" scoped>
@import '~@/scss/base.scss';
.ad-item{
  background: white;
  display: flex;
  margin: 0 10px;
  border-radius: 5px;
  box-shadow: 0px 1px 10px rgba(0, 0, 0, .13);
  margin-bottom: $base-padding;
  position: relative;
  flex-direction: column;
  .item-head {
    display: flex;
    font-size: 12px;
    padding: $base-padding / 2 $base-padding * 3 $base-padding / 2 $base-padding;
    align-items: center;
    border-bottom: 1px solid $border-color;
    .item-num {
      color: $hint-color;
    }
    .item-title{
      font-size: 1.25em;
      text-align: left;
      padding-left: $base-padding;
      flex-grow: 1;
    }
    .img{
      width: $icon-size;
      height: $icon-size;
      border-radius: 50%;
    }
    .tag{
      width: $icon-size;
      height: $icon-size;
      position: absolute;
      right: 0;
      top: 0;
      border: none;
      background-image: url('~@/assets/img/tag_fast.png');
      background-size: $icon-size $icon-size;
      &.tag1 {
        background-image: url('~@/assets/img/tag_fast.png');
      }
      &.tag2 {
        background-image: url('~@/assets/img/tag_high.png');
      }
      &.tag3 {
        background-image: url('~@/assets/img/tag_great.png');
      }
      &.tag4 {
        background-image: url('~@/assets/img/tag_low.png');
      }
    }
  }
  .item-content{
    display: flex;
    .content-left {
      flex-grow: 2;
      flex-basis: 0;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      padding: $base-padding $base-padding / 2;
      border-right: 1px solid $border-color;
      .left-title{
        font-size: $title-size * 1.25;
        color: $red;
      }
      .left-txt{
        color: $hint-color;
      }
    }
    .content-right{
      justify-content: space-between;
      flex-grow: 3;
      flex-basis: 0;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      padding: $base-padding;
      .rigth-content{
        text-align: left;
        color: $hint-color;
        flex-grow: 3;
        flex-basis: 0;
        flex-shrink: 0;
      }
      .rigth-button{
        min-width: 80px;
        flex-grow: 2;
        flex-basis: 0;
        flex-shrink: 0;
        display: flex;
        justify-content: center;
        .button{
          color: white;
          background: $active-color;
          border: none;
          border-radius: 20px;
          font-weight: 100;
          // background: white;
          // color: $red;
          // border: 1px solid $red;
          padding: $base-padding / 2 $base-padding;
        }
      }
    }
  }
}
</style>

